from itertools import combinations


class Transformer:
    def __init__(self, prearr):
        self.__prearr = prearr

    @property
    def prearr(self):
        return self.__prearr

    def combinate(self, c_count):
        group = []
        for item in self.prearr:
            record = ''
            redcomb = combinations(list(item[2]), c_count)
            for subitem in redcomb:
                record += str(item[0]) + ',' + str(item[1]) + ','
                redseries = ''
                for redball in subitem:
                    redseries += str(redball) + ' '
                redseries = redseries[0:len(redseries) - 1]
                redseries += ','
                record += redseries + str(item[3])
            group.append(record[0:len(record) - 1])
        return group

